package networkInterface;

import java.io.File;
import observerNotification.ErrorObserverNotification;
import model.Datagram;


/**
 * FromNetWork interface
 * 
 * <p>
 * <ul>
 * <li>Project: 	ChatSystemG3</li>
 * </ul>
 * </p>
 * 
 * @author COMBES Nicolas - LECHANTRE Arnaud
 */
public interface FromNetwork {
	
	/**
	 * Notifies the controller that a new UDP message has been received
	 * @param d datagram containing received message and sender address
	 */
	public void receiveUDPDatagram(Datagram d);
	
	/**
	 * Receives a packet via TCP and save contained file in given directory
	 * @param convId identifier of the conversation in which we are listenning for an incoming packet
	 * @param directory directory where to save the file
	 */
	public void receiveTCPPacket( int convId, File directory);
	
	/**
	 * Removes the receiver from fileReceiverList and inform the user that the transfer is over
	 * 
	 * @param chatNIFileReceiver receiver that has received the file
	 * @param convId identifier of the conversation in which we were waiting for the file
	 */
	public void notifyFileReceived(ChatNIFileReceiver chatNIFileReceiver, int convId);
	
	/**
	 * Removes the receiver from fileReceiverList and inform the user that the transfer has aborted
	 * @param chatNIFileReceiver receiver that was receiving the file
	 * @param convId identifier of the conversation in which we were waiting for the file
	 */
	public void notifyFileReceptionAbort(ChatNIFileReceiver chatNIFileReceiver,int convId);
	
	/**
	 * relayError
	 * @param error error to pass to the controller
	 */
	public void relayError(ErrorObserverNotification error);
}
